<style lang="less">
    @import '../../styles/common.less';
    @import '../tables/components/table.less';
</style>
<template>
    <div>
        <Row style="background:#eee;">
            <Col span="24">
            <Card :bordered="false">
                <p slot="title">申请基本信息</p>
                <p><span class="infoTitle">用户名:</span> <span v-text="userName"></span></p>
                <p><span class="infoTitle">真实姓名:</span> <span v-text="idName"></span></p>
                <p><span class="infoTitle">国籍: </span><span v-text="country"></span></p>
                <p><span class="infoTitle">身份证号: </span><span v-text="idNumber"></span></p>
            </Card>
            </Col>
            <Col span="24" style="margin-top: 10px;">
            <Card shadow v-if="ranks">
                <p slot="title">证件审核</p>
                <div class="identityImgWrap">
                    <div class="identityImgInner">
                        <img :src="takeOne" alt="">
                    </div>
                    <div class="identityImgInner">
                        <img :src="takeFour" alt="">
                    </div>
                    <div class="identityImgInner">
                        <img :src="handTakeOne" alt="">
                    </div>
                </div>
            </Card>
            </Col>
        </Row>
        <Card shadow style="margin-top: 10px;">
            <Form class="step-form"  :model="step" :label-width="100">
                <FormItem label="是否通过：" required>
                    <RadioGroup v-model="step.pass" >
                        <Radio  :disabled="hasSubmit" label="通过"></Radio>
                        <Radio  :disabled="hasSubmit" label="不通过"></Radio>
                    </RadioGroup>
                </FormItem>
                <FormItem label="备注：">
                    <Input :disabled="hasSubmit" v-model="step.remark" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入备注" />
                </FormItem>
                <FormItem label="">
                    <Button :disabled="hasSubmit" @click="handleSubmit" style="width:100px;" type="primary">提交</Button>
                </FormItem>
            </Form>
        </Card>
    </div>
</template>
<script>
    import $http from '../../utils/axiosWrap';
    import Cookies from 'js-cookie'

    export default {
        name: 'CountToInner',
        data () {
            return {
                userName: '', // 用户名
                idName: '', // 真实姓名
                country: '', // 国际
                takeFour: '', // 反面照
                idNumber: '', // idcard
                handTakeOne: '', // 手持正面照
                takeOne: '', // 正面照
                id:'',
                ranks:'',
                step: {
                    remark: '',
                    pass: '通过'
                },
                hasSubmit: false,
                currentStep: 0,
                status: 'wait'
            };
        },
        created: function () {
            this.userName = this.$route.params.row.userName
            this.idName = this.$route.params.row.idName
            this.country = this.$route.params.row.country
            this.takeFour = this.$route.params.row.takeFour
            this.idNumber = this.$route.params.row.idNumber
            this.handTakeOne = this.$route.params.row.handTakeOne
            this.takeOne = this.$route.params.row.takeOne
            if(this.$route.params.row.ranks == '1'){
                this.ranks = false
            }else{
                this.ranks = true
            }
            this.id = this.$route.params.row.id
        },
        methods: {
            handleSubmit () {
                let _this = this
                let params = new URLSearchParams()
                params.append('auditorUser',Cookies.get('user'))
                params.append('id',_this.id)
                if (_this.step.pass === '通过') {
                    params.append('auditorStatus','1')
                }else{
                    params.append('auditorStatus','2')
                    params.append('remark',_this.step.remark)
                }
                _this.hasSubmit = true;
                $http.post('/userBasic/auditorUserIdentity',params).then(function (res) {
                    if(res.suc){
                        _this.$Message.info('审核成功!')
                        _this.$router.push({
                            name: 'identityIndex'
                        })
                    }else{
                        _this.$Message.info('审核失败!')
                    }
                    _this.hasSubmit = false;
                })
            }
        }
    };
</script>
<style>
    .identityWrap{
        width: 100%;
        min-height: 100%;
        background: #fff;
        margin-top: 10px;
    }
    .identityImgWrap{
        height: 240px;
        display: flex;
        align-items: center;
        justify-content: space-around;
    }
    .identityImgInner{
        width: 360px;
        height: 220px;
        float: left;
        border:1px solid #eeeeee;
        border-radius: 5px;
    }
    .identityImgInner>img{
        width: 100%;
        height: 100%;
    }
    .identityImgInner p{
        margin-top: 200px;
        text-align: center;
    }

</style>

